package com.ttbj.controller.salesman;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
public class IndexController {
	
	//登录成功后进入index页面
	@RequestMapping("/index.htm")
	public String  successLogin(HttpServletRequest request){
		return "index";
	}
	
	@RequestMapping("/login.htm")
	public String login(HttpServletRequest request){
		//获取主体
		Subject subject = SecurityUtils.getSubject();
		//验证是否登录
		if (subject.isAuthenticated()) {
			return "redirect:/index.htm";
		}
		return "login";
	}
	
	 //进入index页面的主页链接
	 @RequestMapping("/home.htm")
	 public String gotoHome(){
		 return "home";
	 }
	
}
